package com.model;
// default package

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;


/**
 * Class entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="db_class"
    ,catalog="acmctgu"
)

public class Clazz  implements java.io.Serializable {


    // Fields    

     private Integer id;
     private Integer classnum;
     private String classname;
     private Set<Student> students = new HashSet<Student>(0);
     private Set<Paper> papers = new HashSet<Paper>(0);


    // Constructors

    /** default constructor */
    public Clazz() {
    }

    
    /** full constructor */
    public Clazz(Integer classnum, String classname,  Set<Student> students) {
        this.classnum = classnum;
        this.classname = classname;
        this.students = students;
    }

   
    // Property accessors
    @GenericGenerator(name="generator", strategy="increment")@Id @GeneratedValue(generator="generator")
    
    @Column(name="id", unique=true, nullable=false)

    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }
    
    @Column(name="classnum")

    public Integer getClassnum() {
        return this.classnum;
    }
    
    public void setClassnum(Integer classnum) {
        this.classnum = classnum;
    }
    
    @Column(name="classname", length=40)

    public String getClassname() {
        return this.classname;
    }
    
    public void setClassname(String classname) {
        this.classname = classname;
    }

@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="clazz")

    public Set<Student> getStudents() {
        return this.students;
    }
    
    public void setStudents(Set<Student> students) {
        this.students = students;
    }

    @ManyToMany(mappedBy="classes",cascade=CascadeType.MERGE, fetch=FetchType.LAZY)
	public Set<Paper> getPapers() {
		return papers;
	}


	public void setPapers(Set<Paper> papers) {
		this.papers = papers;
	}
   








}